<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>修改项目</title> 


    <link type="text/css" href="/TopJUI/topjui/css/topjui.core.min.css" rel="stylesheet">
    <link type="text/css" href="/TopJUI/topjui/themes/default/topjui.green.css" rel="stylesheet" id="dynamicTheme"/>
    <!-- FontAwesome字体图标 -->
    <link type="text/css" href="/TopJUI/topjui/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- 图片上传样式 -->
    <link type="text/css" href="/TopJUI/upload/css/upload.css" rel="stylesheet"/>
    <!-- jQuery相关引用 -->
    <script type="text/javascript" src="/TopJUI/topjui/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/TopJUI/topjui/plugins/jquery/jquery.cookie.js"></script>
    <!-- TopJUI框架配置 -->
    <script type="text/javascript" src="/TopJUI/static/public/js/topjui.config.js"></script>
    <!-- TopJUI框架核心-->
    <script type="text/javascript" src="/TopJUI/topjui/js/topjui.core.min.js"></script>
    <!-- TopJUI中文支持 -->
    <script type="text/javascript" src="/TopJUI/topjui/js/locale/topjui.lang.zh_CN.js"></script>

    <script type="text/javascript" src="/pages/js/moment.min.js"></script>
    <script type="text/javascript" src="/pages/js/layer/layer.js"></script>
    <script type="text/javascript" src="/pages/js/util.js"></script>
    <script type="text/javascript" src="/pages/js/shuoheUtil.js"></script>
    
    <!-- 图片上传js -->
    <script type="text/javascript" src="/TopJUI/upload/js/upload.js"></script>

    
    
<style type="text/css">
    html, body{ margin:0; height:100%;width: 100%;overflow: auto;}
</style>


<body>
    <table class="editTable" style="text-align: center;" >
        <tr>
            <td class="label" colspan="4" style="text-align: left;font-size: 20px;">
                <div class="divider">
                    <span style="margin-left: 50px">项目信息</span>
                </div>
            </td>
        </tr>               
        <tr>
            <td class="label">项目编号</td>
            <td >
                <input id='project_id' class="easyui-textbox" data-options="required:false,width:200,editable:true">
            </td>

            <td class="label">项目名称</td>
            <td >
                <input id='project_name' class="easyui-textbox" data-options="required:false,width:200,editable:true">
            </td>
        </tr>
        <tr>
            <td class="label">合同编号</td>
            <td >                
                <input id='contract_id' class="easyui-textbox" data-options="required:false,width:200,editable:true">
            </td>                
            </td>

            <td class="label">合同签署日期</td>
            <td >
                <input id='contract_sign_date' class="easyui-datebox" data-options="required:false,width:200,editable:true">
            </td>
        </tr>
        <tr>            
            <td class="label">合同周期</td>
            <td >                
                <input id='contract_cycle_day' class="easyui-numberbox" data-options="required:false,width:200,editable:true">
            </td>                
            </td>

            <td class="label">合同交付日期</td>
            <td >
                <input id='contract_deliver_date' class="easyui-datebox" data-options="required:false,width:200,editable:true">
            </td>
        </tr>
        <tr>            
            <td class="label">客户公司</td>
            <td >                
                <input id='company_id' class="easyui-combobox" data-options="required:false,width:200,editable:true">
            </td>                
            </td>
        </tr>
        <tr>            
            <td class="label">项目地址</td>
            <td colspan="3">                
                <input id='project_url' class="easyui-textbox" data-options="required:false,width:550,editable:true">
            </td>                
        </tr>

        <tr style="margin-top: 100px">
            <td></td>
            <td >
            </td>
            <td>
            </td>
            <td  style="text-align: right;margin-top: 100px">
                  <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-save',plain:true" onclick="save()" style="color:black;width:80px;height:auto;background-color: #00CD66">保存</a>
            </td>               
        </tr>          
    </table>
    
</body> 
</html>
<script type="text/javascript">


    var id = shuoheUtil.getUrlHeader().id;
    var project = new Object();

    $(function()
    {
        shuoheUtil.layerSaveMaskOn();



        $('#company_id').combobox({
            url: '/develop/url/getUrl.do',
            valueField: 'id',
            textField: 'name',
            panelHeight: 200,
            method: 'get',
            multiple: false,
            queryParams: {
                'name': 'getCompanyForList'
            },
            onLoadSuccess: function() {
                $('#company_id').combobox('setValue',project.company_id);
            },
            onSelect: function(ret) {}
        });


        $.ajax({
            url: '/develop/url/getUrl.do',
            type: "POST",
            dataType: 'json',
            data: {
                'name': 'getProjctForObjectById',
                'id':id
            },
            error: function() //失败
            {
                shuoheUtil.layerSaveMaskOff();
            },
            success: function(data) //成功
            {
                shuoheUtil.layerSaveMaskOff();
                project = data;
                $('#project_id').textbox('setValue',data.project_id);
                $('#project_name').textbox('setValue',data.project_name);
                $('#contract_id').textbox('setValue',data.contract_id);
                $('#contract_sign_date').datebox('setValue',data.contract_sign_date);
                $('#contract_cycle_day').numberbox('setValue',data.contract_cycle_day);
                $('#contract_deliver_date').datebox('setValue',data.contract_deliver_date);
                $('#company_id').combobox('setValue',data.company_id);
                $('#project_url').textbox('setValue',data.project_url);

            }
        });
    });


  $(function(){

        $('#company_id').combobox({
            url: '/develop/url/getUrl.do',
            valueField: 'id',
            textField: 'name',
            panelHeight: 200,
            method: 'get',
            multiple: false,
            queryParams: {
                'name': 'getCompanyForList'
            },
            onLoadSuccess: function() {

            },
            onSelect: function(ret) {}
        });
    })


    function save() {

        shuoheUtil.layerTopMaskOn();

        project.project_id = $('#project_id').textbox('getValue');
        project.project_name = $('#project_name').textbox('getValue');
        project.contract_id = $('#contract_id').textbox('getValue');
        project.contract_sign_date = $('#contract_sign_date').datebox('getValue');
        project.contract_cycle_day = $('#contract_cycle_day').numberbox('getValue');
        project.contract_deliver_date = $('#contract_deliver_date').datebox('getValue');
        project.company_id = $('#company_id').combobox('getValue');
        project.project_url = $('#project_url').textbox('getValue');

        $.ajax({
            url:'/pm2/project/project/save.do',
            type: "POST",
            dataType: 'json',
            data: {
                'data': JSON.stringify(project)
            },
            error: function() //失败
            {
                shuoheUtil.layerTopMaskOff();
            },
            success: function(data) //成功
            {
                shuoheUtil.layerTopMaskOff();
                if (data.result == true) {
                    shuoheUtil.layerClose();
                    parent.updateSuccess();
                } else
                    shuoheUtil.layerMsgCustom(data.describe);
            }
        });
    }

</script>